UI - Python
label = tk.Label(root, text="Enter Name: ")
textbox = tk.Text(root, height = 2, width=50)
We can use tk.Entery() method to create textbox with height=1,
textbox2 = tk.Entery(root, width=50)
button = tk.Button(root,text="Click here")
In all of the control creation methods, first parameter passed is reference to container object, here root
We can assign event to control by pass command parameter to the control creation method. that is:
button = tk.Button(root,text="submit",command = click)
here, click is an function
import tkinter as tk
def click():
print("click")
root = tk.Tk()
root.geometry("300x300")
label = tk.Label(root, text="Hello World",font=("Arial", 25))
label.pack(padx=10, pady=10)
textbox = tk.Text(root, height=2, width=50)
textbox.pack(padx=10, pady=10)
button = tk.Button(root, text="Click me",command=click)
button.pack(padx=10, pady=10)
chk = tk.Checkbutton(root, text="Check")
chk.pack(padx=10, pady=10)
root.mainloop()